// 登陆模块
import cModuleMgr from "../SuperMgr/cModuleMgr"
import cDataMgr from "../DataMgr/cDataMgr"
import cMsgModule from "../Message/cMessgModule"
import cEnumMds from "../Enum/cEnumMds"
import cEnumMsg from "../Enum/cEnumMsg"
import cEnumPab from "../Enum/cEnumPab"
import cEnumMgr from "../Enum/cEnumMgr"
export default class cLoginModule extends cModuleMgr {
    private msgModule:cMsgModule = this.getModule(cEnumMds.mssegModule);
    private infModule:cMsgModule = this.getModule(cEnumMds.mssegModule);
    constructor(){
        super(cEnumMds.loginModule);
        this.portraitscreen();//竖屏模式
        this.settingnode(0);
        this.setSpanel(cEnumPab.clientLogin);
    }

    public dispatchs(data:msgBody) {
        let cmd = data.cmds.pop()
        switch(cmd){
            case cEnumMsg.s2c_loginResult:{
                //保存账号数据
                cDataMgr.setData(cmd,data.info)
                //请求联盟数据
                this.msgModule.sendcmds([cEnumMgr.clubs,cEnumMsg.c2s_clubClubs])
                break
            }
            case cEnumMsg.s2c_clubClubs:{
                //保存联盟数据
                cDataMgr.setData(cmd,data.info)
                //切换到大厅场景
                let lobby:cModuleMgr = this.getModule(cEnumMds.lobbyModule)
                lobby.changeStart()
                break
            }
        }
    }
}